﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Example_68
{
    public class SapXep
    {
        public void SapXepTang (float []a,int n)
        {
            for (int i=0;i<n;i++)
            {
                for (int j=i+1;j<n;j++)
                    if (a[i]>a[j])
                    {
                        float t = a[i];
                        a[i] = a[j];
                        a[j] = t;
                    }
            }
        }
        public void SapXepGiam(float[] a, int n)
        {
            for (int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                    if (a[i] < a[j])
                    {
                        float t = a[i];
                        a[i] = a[j];
                        a[j] = t;
                    }
            }
        }
        public void Print (float[]a,int n)
        {
            for (int i=0;i<n;i++)
            {
                Console.WriteLine(a[i]);
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            float[] sn = new float[10];
            sn[0] = 5;
            sn[1] = 6; 
            sn[2] = 3;
            SapXep sx = new SapXep();
            sx.SapXepTang(sn, 3);
            sx.Print(sn, 3);
            sx.SapXepGiam(sn, 3);
            sx.Print(sn, 3);
        }
    }
}
